


     C2PS(1)                   (15 May 1997)                   C2PS(1)



     NAME
          c2ps - converts a file with C/C++ code to Postscript

     SYNOPSIS
          c2ps [ -?h124abceikmnruvwx ] [ -F defaultfont ] [
          -C commentfont ] [ -K keywordfont ] [ -N lnumberfont ] [
          -P preprocfont ] [ -S stringfont ] [ -T typefont ] [
          -U functionfont ] [ -X nonlatinfont ] [ -d dim ] [
          -f fontsize ] [ -l lines ] [ -p paper ] [ -o outputfile ] [
          -s space ] [ -t tabsize ] [ -_  fun_highlight ] [
          -DPREPROC_VAR ...  ] [ -UPREPROC_VAR ...  ] [ file ... ]


     DESCRIPTION
          Converts the specified file(s) containing C/C++ code to
          Postscript output conforming to the Adobe Structuring
          Conventions.

          If no input file is specified then input is accepted from
          stdin.  Postscript output is directed to stdout unless you
          specify an output file.  The actual output page may be out
          with one, two or four columns.

          Supported paper types are A4 and Letter.

          Tabs in the input stream are expanded (by default) by blank
          characters to the closest modulo 8 position. You can specify
          your own constant number of blanks different from 8 for a
          tab to expand.

          A formfeed (^L) character makes the converter move to the
          next column.

          By default, C/C++ constructs are highlighted with following
          standard fonts presented on every Postscript printer:

               Preprocessor directives  Courier-BoldOblique

               Comments                 Helvetica-Oblique

               Strings                  Courier-Oblique

               Keywords                 Courier-Bold

               Line numbers             Times-Roman

               Types                    Courier-Bold

               Function identificators  Bookman-LightItalic

          The rest is printed with Courier (default font). If
          highlighting is disabled only the default font is used to



     Page 1                                          (printed 5/19/97)






     C2PS(1)                   (15 May 1997)                   C2PS(1)



          print the read code (but not line numbers).

          Comments may be printed dimmed to a configurable degree in a
          way that allows reader to concentrate mainly on the source
          itself referring to comments only when needed.

          c2ps has basic preprocessor capabilities. You may
          define/undefine preprocessor variables in the command line.
          c2ps will neglect those pieces of code that are cut out by
          the preprocessor given a set of mentioned variables.

          By default, on each column c2ps draws an alphabetic index of
          all function id definitions with locations, scanned from the
          beginning of the file being printed.  As the number of these
          id's grows the font used to print the index may get smaller
          in order to accommodate all the entries.

          Occasionally, function index is drawn upon already printed
          source code.  To cope with this you can either cancel the
          index option or use smaller fonts.

          All the read symbols with codes 128..255 (0x80..0xff) are
          printed escaped so that c2ps output is all clean 7-bit ascii
          and can be sent over the Internet without uuencoding.

          You can easily print source including fragments in Cyrillic,
          Hebrew, Arabic etc.  which may be found in string and/or
          comments if you're printing C/C++ code and anywhere
          otherwise. You just need a postscript font with encoding
          corresponding to the one that is used in the above
          fragments. If there's no suitable built-in font in your PS
          printer you will have to prepend one to c2ps output.

          If the symbols from the both halves of the code table are
          implemented in your PS font, you may simply use it to print
          any constructs that include 8-bit text (don't forget to
          disable ISO Latin 1 font reencoding).  Otherwise, with only
          upper half symbols (with codes > 127(0x7f)) implemented,
          there is an option to set a font to print specifically these
          symbols leaving the rest to be printed by either default or
          newly set fonts.

          Also, as much as we know there exists a version of c2ps
          modified to support Chinese (Hanja) and Korean (Hangul). An
          address of the implementor is on the c2ps web page.

          This is a manual page for c2ps ver4.0


     OPTIONS
          -? -h
               Print usage message.



     Page 2                                          (printed 5/19/97)






     C2PS(1)                   (15 May 1997)                   C2PS(1)



          -1   Specify single column per page output - default
               (portrait).


          -2   Specify two columns per page output (1/2 size,
               landscape).


          -4   Specifiy four columns per page output (1/4 size,
               portrait).


          -a   Disable adjusted multiple lines comments printing.


          -b   Disable drawing a box containing alphabetic index of
               functions scanned from the beginning of the file.


          -c   Disable C/C++ construct highlighting.


          -e   Disable printing entry/exit function name in the
               column's header.


          -i   Disable ISO 8859-1 (ISO Latin 1) character encoding.


          -k   Use standard set of keywords rather than extended one.


          -m   When printing a file use the date of printing instead
               of file's last modification date.


          -n   Disable line numbering.


          -r   Draw a frame round each column.


          -u   Disable drawing header at the top of each column.


          -v   Print current version.


          -w   Disable wrapping too wide lines onto following lines.
               Note, that when wrapping is enabled the maximum number
               of characters in line printed with any font is the
               number of the same point size Courier characters that



     Page 3                                          (printed 5/19/97)






     C2PS(1)                   (15 May 1997)                   C2PS(1)



               may appear in single line without crossing column's
               border.


          -x   Automatically toggle C/C++ highlight flag for each file
               according to its extension.  ( Applicable extensions
               include  .c .h .cc .hh .cpp .hpp )


          -F defaultfont
               Use defaultfont as default font.


          -C commentfont
                Use commentfont to print comments.


          -K keywordfont
               Use keywordfont to print keywords.


          -N lnumberfont
               Use lnumberfont to print line numbers.


          -P preprocfont
               Use preprocfont to print preprocessor directives.


          -S stringfont
               Use stringfont to print strings.


          -T typefont
               Use typefont to print types.


          -U functionfont
               Use functionfont to print function identificators being
               defined.


          -X nonlatinfont
               Use nonlatinfont to print all symbols with codes >
               127(0x7f). ISO Latin 1 encoding is automatically
               cancelled.


          -d dim
               Print comments dimmed with the coefficient dim.
                ( black: 0.0 <= dim <= 1.0 :white ). Default is 0.75.
               So you can actually get rid of the comments in your



     Page 4                                          (printed 5/19/97)






     C2PS(1)                   (15 May 1997)                   C2PS(1)



               printout by setting dim coef. to 1.0


          -f pointsize
               Use pointsize -scaled fonts ( 10 - default ).


          -l lines
               Make converter start a new column after each set of
               lines printed lines. You may want to use the resulted
               at the bottom of the column white space for notes if
               the space on the right is not sufficient.


          -p paper
               Paper type specification ( A4 - default, Letter ).


          -s points
               Leave points * 1/72 inch space between lines ( 0.0 -
               default ).


          -t tabsize
               Expand each read tab with blanks to a next modulo
               tabsize position ( 8 - default ).


          -_  fun_highlight
               Specify function id highlighting type ( none, box,
               underline - default ).


          -DPREPROC_VAR

          -UPREPROC_VAR
               You may define or undefine preprocessor variables in a
               standard compiler option fashion.

               Below:
                +/-: printed/not printed by c2ps
                column 1: for variable X not mentioned in command line
                column 2: for variable X defined
                column 3: for variable X undefined

                  1  2  3
                  +  -  -    #ifdef X
                  +  +  -      C/C++ code (+ preprocessor directives)
                  +  -  -    #else
                  +  -  +      C/C++ code (+ preprocessor directives)
                  +  -  -    #endif




     Page 5                                          (printed 5/19/97)






     C2PS(1)                   (15 May 1997)                   C2PS(1)



               Similarly for #ifndef, just switch columns 2 and 3.



     EXAMPLES
          Multiple files
             c2ps *.c *.h | lpr

          Ordinary text
             c2ps note.txt -c -n -u > note.ps

          ISO Latin 1 font reencoding by default
             c2ps -2 -c -n -F Times-Roman german.txt > german.ps

          A different look
             c2ps -F Times-Roman -C Palatino-BoldItalic -K Times-Bold
                  -N Helvetica -P Helvetica-Bold -S Times-Italic
                  -T Times-BoldItalic -_ box -w sample.c > sample.ps

          An option set looking better on low resolution printers
             c2ps -d 0 -C Palatino-Italic main.cc > main.ps

          Partial preprocessing, selective printing
             c2ps -DDEBUG -DSUN_SPECIFIC -UPRINT *.cc | lpr

          Temporarily commented out code (still looks like a part of
          the code but a little bit dimmed)
             c2ps -C Courier -d 0.5 temp.c -o temp.ps

          Getting rid of comments
             c2ps -_ box -d 1 main.cc | lpr

          Printing 8-bit text (e.g. Cyrillic, koi-8 encoding)
             c2ps -i -C Antique-Italic -S Antique koi8.cc > tmp
             cat Antique-Italic.pfa Antique.pfa tmp | lpr

             c2ps -i -c -n -F Antique koi8.cc > tmp
             cat Antique.pfa tmp | lpr

             c2ps -X Cyrillic-Italic-koi8 koi8.cc > tmp
             cat Cyrillic-Italic-koi8.ps tmp | lpr


     BUGS
          c2ps is generally quite stable. Howerver, if you encounter
          any problem using it, please, send a report to:

             c2ps@geocities.com

          Last version of c2ps is located at

             http://www.geocities.com/SiliconValley/Park/2055/



     Page 6                                          (printed 5/19/97)






     C2PS(1)                   (15 May 1997)                   C2PS(1)



     SEE ALSO
          enscript, vgrind, troff, pprint, a2ps


     ACKNOWLEDGEMENTS
          We would like to thank Prof. Daniel Berry of the Technion
          who has supervised this project at its beginning for
          numerous most useful recommendations.  Also, we are very
          thankful for many suggestions, proposals and of course bug
          reports that have been received.


     AUTHORS
          Dmitri Shtilman
          Dmitri Makarov















































     Page 7                                          (printed 5/19/97)
